<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }
      .box {
        text-align: center;
      }
      .box2 {
        width: 100vw;
        height: 100px;
        background-color: aqua;
        display: flex;
        justify-content: center;
      }
      /* 让自己居中 设置margin ，设置宽度 */
      .box3 {
        width: 100px;
        height: 100px;
        background-color: aqua;
        margin: 0 auto;
      }
    </style>
  </head>
  <body>
    <!-- 行内元素 -水平居中-->
    <div class="box">
      <span>张三李四王五</span>
    </div>
    <!-- 块级元素 -水平居中-->
    <div class="box2">
      <div>张三</div>
      <div>张三</div>
      <div>张三</div>
    </div>
    <div class="box3"></div>
  </body>
</html>
